classDiagram

FactorStack "1" *-- "1..*" Factor
Factor *-- IOperator
FactorStack --> FactorState : generate
IOperator <|-- IOperatorWithStack
IOperator <|-- NullOperator
IOperator <|-- AddOperator
IOperator <|-- SubtractOperator
IOperator <|-- MultiplyOperator
IOperator <|-- DivideOperator
IOperatorWithStack <|-- ResetOperator

class IOperator {
    &lt;&lt;interface&gt;&gt;
    +Compute(Lh, Rh)
    +GetInverse() IOperator
}

class IOperatorWithStack {
    &lt;&lt;interface&gt;&gt;
    +SetStack(FactorStack Stack) void
    +SetKeyInStack(int32 Key) void
}

class FactorStack {
    +GetCurrentState() FactorState
    +AddTime(int32 Time)
    +Get(int32 Key) Factor
    +Add(Factor Factor)
}
